﻿
@{
    ViewData["Title"] = "会议通知";
    Layout = "~/Views/Shared/_List.cshtml";
}

<div class="kit-table">
    <div id="toolbar" class="kit-table-header">
        <div class="layui-btn-group lonewolf-btns">
            <button onclick="btnAdd('/Menu/MenuForm','新增菜单','670px','470px')" class="layui-btn layui-btn-primary layui-btn-sm">   <i class="fa fa-modx" aria-hidden="true"></i> 新增会议通知</button>
        </div>
        <style>
            .kit-search-keyword .layui-form-select dl {
                top: 31px;
            }

                .kit-search-keyword .layui-form-select dl dd {
                    line-height: 30px;
                }
        </style>
        <div class="kit-search-inputs " style="width:450px;">
            <div class="layui-inline kit-search-keyword" style="float:left;">
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="test6" placeholder="请选择时间范围">
                </div>
            </div>
            <div class="kit-search-keyword" style="float:right;">
                <input type="text" class="layui-input" name="keyword" id="keyword" placeholder="搜索关键字.." />
                <button href="javascript:;" onclick="initGrid()"><i class="layui-icon">&#xe615;</i></button>
            </div>
        </div>
    </div>
    <div class="kit-table-body">
        <table class="layui-table" lay-data="{height:'full-49', url:'/TestData/GetArc.json',method:'get', page:true, id:'TableList'}" lay-filter="demo">
            <thead>
                <tr>
                    <th lay-data="{field:'Title', sort: true}">会议主题</th>
                    <th lay-data="{field:'Type', width:100, sort: true}">会议地点</th>
                    <th lay-data="{field:'Time', width:100, sort: true}">会议时间</th>
                    <th lay-data="{field:'NumT', width:100,event: 'setSign', style:'cursor: pointer;'}">参加(人)</th>
                    <th lay-data="{field:'NumT',  toolbar: '#barD', width:100}">不参加(人)</th>
                    <th lay-data="{field:'NumT', width:100,event: 'setgign', style:'cursor: pointer;'}">未处理(人)</th>
                    <th lay-data="{fixed: 'right',  toolbar: '#barDemo', width:180}">操作</th>
                </tr>
            </thead>
        </table>
    </div>
</div>
<script type="text/html" id="barD">
    <span class="layui-badge">{{d.NumT}}</span>
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="edit">发布</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    var table;
    var $;
    layui.use(['table', 'form','laydate'], function () {
        $ = layui.jquery;
        var form = layui.form;
        table = layui.table;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#test6'
            , range: false
        });
        table.on('tool(demo)', function (obj) {
            var data = obj.data;
            if (obj.event === 'setSign') { 
                layer.prompt({
                    formType: 2
                    , title: '确认参与名单'
                    , value: "张三 李四 ...等10人"
                }, function (value, index) {
                    layer.close(index);
                    obj.update({
                        sign: value
                    });
                });
            } else{
                layer.prompt({
                    formType: 2
                    , title: '未确认名单'
                    , value: "张三 李四 ...等10人"
                }, function (value, index) {
                    layer.confirm('是否对此名单再次发送会议通知？', {
                        btn: ['发送', '不发送'] //按钮
                    }, function () {
                        layer.msg('发送成功！', { icon: 1 });
                        });
                    layer.close(index);
                    obj.update({
                        sign: value
                    });
                });
            }
        });
    });

    function btnAdd(url, title, width, height) {
        layer.open({
            type:2,
            title: title,
            area: [width, height],
            content: url,
            btn: ['关闭'],
            yes: function (index) {
                layer.close(index);
            }
        });
    }
</script>

